package org.toycode.solr.config;

import java.util.List;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;

/**
 * This class depicts the type of the entity need to be indexed and searched.
 *
 * @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
 * @version 1.0.0.4, Aug 27, 2009
 */
final public class Entity {

    /**
     * class of this type.
     */
    @XmlAttribute(name = "class")
    public String clazz;
    /**
     * display name of this type.
     */
    @XmlAttribute
    public String displayName;
    /**
     * properties of this type. 
     */
    @XmlElements(@XmlElement(name = "prop", type = Prop.class))
    public List<Prop> props;
    /**
     * indicates the operation while indexing types occur duplication of unique
     * key. Default opertion is {@code UNIQUE_KEY_PASS_OPERTION}, means pass
     * the update for the type, and an optional operation is
     * {@code UNIQUE_KEY_UPDATE_OPERTION}, means update the type.
     */
    @XmlAttribute(required = true)
    public String duplicatedUniqueKeyOperation = UNIQUE_KEY_PASS_OPERTION;
    /**
     * indicates the <em>pass</em> operation while indexing types occur
     * duplication of unique key.
     */
    public static final String UNIQUE_KEY_PASS_OPERTION = "pass";
    /**
     * indicates the <em>update</em> operation while indexing types occur
     * duplication of unique key.
     */
    public static final String UNIQUE_KEY_UPDATE_OPERTION = "update";
}
